import { moduleRequest } from "./axios";

const GET_URL = "list";
const ADD_URL = "add";
const EDIT_URL = "edit";
const DELETE_URL = "delete";
const GET_DETAIL_URL = "detail";
const BATCH_UPDATE_URL = "batchUpdate";

export enum TYPE {
  WIDGET = "widget",
  SITE = "site",
  FOLDER = "folder",
}

export interface Icon {
  id?: string;

  name: string;
  target: string;
  iconGroupId: string;
  bgType: string;
  bgImage: string;
  bgColor: string;
  type: string;
  origin: string;
  bgText: string;
}

const request = moduleRequest(`/biz/portaluserpage/`);
export default {
  get(data) {
    return request(GET_URL, data, "get");
  },
  add(data: Icon) {
    return request(ADD_URL, data, "post");
  },
  edit(data: Icon) {
    return request(EDIT_URL, data, "post");
  },
  delete(data) {
    return request(DELETE_URL, data, "post");
  },
  getDetail(data) {
    return request(GET_DETAIL_URL, data, "get");
  },
  batchUpdate(data) {
    return request(BATCH_UPDATE_URL, data, "post");
  },
};
